export const isUrl = (path?: string): boolean => {
  return /http(s)?:/.test(path!);
};

export const isPath = (path?: string): boolean => {
  return !isUrl(path);
};

export const toFullUrl = (
  baseUrl: string,
  path?: string
): string | undefined => {
  if (path === undefined) {
    return undefined;
  }
  if (isUrl(path)) {
    return path;
  }
  return `${baseUrl}${path}`;
};
